package com.ldxiwxr.controller.controller.article;

import com.ldxiwxr.common.common.Result;
import com.ldxiwxr.system.service.IArticleCommentService;
import com.ldxiwxr.system.service.IArticleService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * 文章控制层
 * @author SuBanxia
 */
@RestController
@Api(tags = "/ArticleController")
@RequestMapping("/article")
public class ArticleController {

    @Resource
    private IArticleService articleService;

    @Resource
    private IArticleCommentService articleCommentService;

    @ApiOperation("获取文章内容")
    @GetMapping("/articleContent")
    public Result<?> articleContent(String articleId){
        return Result.data(articleService.getArticleContent(articleId));
    }

    @ApiOperation("获取文章评论")
    @GetMapping("/articleComment")
    public Result<?> articleComment(String articleId){
        return Result.data(articleCommentService.getCommentListByArticleId(articleId));
    }
}
